package com.zline.foodraise.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.ViewGroup;

import com.zline.foodraise.R;
import com.zline.foodraise.entity.CustomerUserBean;
import com.zline.foodraise.entity.UserAddressBean;
import com.zline.foodraise.view.AttentionListItem;
import com.zline.foodraise.view.RecyclerViewLoadMore_;
import com.zline.foodraise.view.ShippingAddrItem;
import com.zline.foodraise.view.ShippingAddrItem_;

import org.androidannotations.annotations.EBean;
import org.androidannotations.annotations.RootContext;

/**
 * Created by heshantao on 15/12/23.
 * 地址管理适配器
 */
@EBean
public class ShippingAddrListAdapter extends LoadRecyclerBaseAdapter<UserAddressBean,ShippingAddrItem> {
    private static final String LOG_TAG = ShippingAddrListAdapter.class.getSimpleName();
    @RootContext
    Context cxt;
    @Override
    protected ShippingAddrItem onCreateItemView(ViewGroup parent, int viewType) {
        return ShippingAddrItem_.build(cxt);
    }

    @Override
    protected BottomWrapper onCreateBottomView(ViewGroup parent, int viewType) {
        return new BottomWrapper(RecyclerViewLoadMore_.build(cxt));
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        if (holder instanceof ContentWrapper) {
            ShippingAddrItem view = (ShippingAddrItem) ((ContentWrapper) holder).getView();
            UserAddressBean addressBean = arrys.get(position);
            view.bind(position,addressBean);
            view.setListener(itemClicked);
        }
    }
}
